package com.mxpio.erp.common.plm.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpio.erp.common.jpa.policy.ResCodeGeneratorPolicy;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper = false)
@Entity
@Table(name = "MB_ERP_PLM_PROJECT_INFO_CHANGE")
@Schema(description = "项目列表变更")
public class ProjectInfoChange extends BaseEntity {
    @Id
    @Column(name = "BIZ_NO_")
    @Schema(description = "申请单号")
    @Generator(policy = ResCodeGeneratorPolicy.class)
    private String bizNo;

    @Column(name = "PRO_CODE_")
    @Schema(description = "项目编码")
    private String proCode;

    /**申请人*/
    @Column(name = "APPLICANT_")
    @Schema(description = "申请人")
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String applicant;

    /**申请时间*/
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(name = "APPLY_TIME_")
    @Schema(description = "申请时间")
    private Date applyTime;

    /**变更类型*/
    @Column(name = "CHANGE_TYPE_")
    @Schema(description = "变更类型")
    @Dict(dicCode = "ERP_PLM_PROJECT_INFO_CHANGE_TYPE") //5变更内容 10项目终止
    private String changeType;

    /**变更原因*/
    @Column(name = "REASON_",columnDefinition="TEXT")
    @Schema(description = "变更原因")
    private String reason;

    /**审批状态*/
    @Column(name = "BPMN_STATUS_")
    @Schema(description = "审批状态")
    @Dict(dicCode = "ERP_COMMON_BPMN_STATUS")
    private String bpmnStatus;

    /**审批实例ID*/
    @Column(name = "PROCESS_INSTANCE_ID_")
    @Schema(description = "审批实例ID")
//    @Generator
    private String processInstanceId;


}
